package com.hckj.medical.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hckj.medical.entity.DoctorMsg;
import com.hckj.medical.mapper.DoctorMsgMapper;
import com.hckj.medical.service.IDoctorMsgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.print.Doc;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author hckj
 * @since 2023-11-25
 */
@Service
public class DoctorMsgServiceImpl extends ServiceImpl<DoctorMsgMapper, DoctorMsg> implements IDoctorMsgService {
    @Autowired
    private DoctorMsgMapper doctorMsgMapper;
    @Override
    public DoctorMsg selectByphone(String username) {
        LambdaQueryWrapper<DoctorMsg> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(DoctorMsg::getUsername,username);
        return doctorMsgMapper.selectOne(queryWrapper);
    }

    @Override
    public List<DoctorMsg> selectAllDoctor(List<Integer> list) {
        LambdaQueryWrapper<DoctorMsg> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.in(DoctorMsg::getType,list);
        return doctorMsgMapper.selectList(queryWrapper);
    }

    @Override
    public DoctorMsg findByid(Integer id) {
        return doctorMsgMapper.selectById(id);
    }

    @Override
    public void updateByid(DoctorMsg doctorMsg) {
        doctorMsgMapper.updateById(doctorMsg);
    }
}
